<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Question extends Model
{
    use HasFactory;
    use SoftDeletes;
    protected $table = 'zfm_questions';
    protected $guarded=[];
    /**
     * 房源信息展示
     * @return mixed
     */
    public static function list(){
        return self::paginate(5);
    }
    /**
     * 房源信息查找
     * @param $where
     * @return mixed
     */
    public static function Seek($field,$field2,$where){
        return self::where($field, 'like', '%'.$where.'%')
            ->orWhere($field2, 'like', '%'.$where.'%')
            ->get();
    }
    /**
     * 房源信息删除
     */
    public static function del($id,$fangId){
        return self::where([$id=>$fangId])
            ->delete();
    }
    /**
     * 房源详情信息
     */
    public static function detail($field,$where){
        return self::where($field,$where)->first();
    }
    /**
     * 房源信息修改
     */
    public static function change($field,$fangID,$SecondaryMessageUpdated){
        return self::where($field,$fangID,$fangID)->update($SecondaryMessageUpdated);
    }
}
